<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998


Bag: an unordered collection with duplicates
-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE ScopedTypeVariables, CPP, DeriveFunctor #-}</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Data.Bag</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier">Bag</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-comment">-- abstract type</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier">unitBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier">unionBags</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier">unionManyBags</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#mapBag"><span class="hs-identifier">mapBag</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier">elemBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier">lengthBag</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier">filterBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier">partitionBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier">partitionBagWith</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#concatBag"><span class="hs-identifier">concatBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#catBagMaybes"><span class="hs-identifier">catBagMaybes</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier">foldBag</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier">isEmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier">isSingletonBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#consBag"><span class="hs-identifier">consBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#snocBag"><span class="hs-identifier">snocBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier">anyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier">allBag</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier">listToBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier">bagToList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier">mapAccumBagL</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier">concatMapBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier">concatMapBagPair</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier">mapMaybeBag</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier">mapBagM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier">mapBagM_</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier">flatMapBagM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier">flatMapBagPairM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier">mapAndUnzipBagM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier">mapAccumBagLM</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier">anyBagM</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier">filterBagM</span></a></span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-32"></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#"><span class="hs-identifier">Data.Data</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier">partition</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier">mapAccumL</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Foldable</span></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span class="hs-keyword">infixr</span><span> </span><span class="hs-number">3</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#consBag"><span class="hs-operator hs-type">`consBag`</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">infixl</span><span> </span><span class="hs-number">3</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#snocBag"><span class="hs-operator hs-type">`snocBag`</span></a></span><span>
</span><span id="line-42"></span><span>
</span><span id="line-43"></span><span class="hs-keyword">data</span><span> </span><span id="Bag"><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-var">Bag</span></a></span></span><span> </span><span id="local-6989586621680827316"><span class="annot"><a href="#local-6989586621680827316"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-44"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="EmptyBag"><span class="annot"><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span></span><span>
</span><span id="line-45"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="UnitBag"><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span></span><span> </span><span class="annot"><a href="#local-6989586621680827316"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-46"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TwoBags"><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827316"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827316"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- INVARIANT: neither branch is empty</span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ListBag"><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680827316"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span>             </span><span class="hs-comment">-- INVARIANT: the list is non-empty</span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827303"><span id="local-6989586621680827310"><span class="annot"><span class="annottext">(forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b)
-&gt; (forall a b. a -&gt; Bag b -&gt; Bag a) -&gt; Functor Bag
forall a b. a -&gt; Bag b -&gt; Bag a
forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b
forall (f :: * -&gt; *).
(forall a b. (a -&gt; b) -&gt; f a -&gt; f b)
-&gt; (forall a b. a -&gt; f b -&gt; f a) -&gt; Functor f
&lt;$ :: forall a b. a -&gt; Bag b -&gt; Bag a
$c&lt;$ :: forall a b. a -&gt; Bag b -&gt; Bag a
fmap :: forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b
$cfmap :: forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b
</span><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Functor</span></a></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span id="local-6989586621680827682"><span class="annot"><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-type">emptyBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827682"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-51"></span><span id="emptyBag"><span class="annot"><span class="annottext">emptyBag :: forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var hs-var">emptyBag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-52"></span><span>
</span><span id="line-53"></span><span id="local-6989586621680827680"><span class="annot"><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-type">unitBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680827680"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827680"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-54"></span><span id="unitBag"><span class="annot"><span class="annottext">unitBag :: forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var hs-var">unitBag</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag a
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span id="local-6989586621680827678"><span class="annot"><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-type">lengthBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827678"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span></span><span>
</span><span id="line-57"></span><span id="lengthBag"><span class="annot"><span class="annottext">lengthBag :: forall a. Bag a -&gt; Int
</span><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var hs-var">lengthBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>
</span><span id="line-58"></span><span class="annot"><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var">lengthBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-59"></span><span class="annot"><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var">lengthBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827294"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827294"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827293"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827293"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Int
forall a. Bag a -&gt; Int
</span><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var">lengthBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827294"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Int
forall a. Bag a -&gt; Int
</span><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var">lengthBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827293"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-60"></span><span class="annot"><a href="GHC.Data.Bag.html#lengthBag"><span class="hs-identifier hs-var">lengthBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827291"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827291"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827291"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span id="local-6989586621680827673"><span class="annot"><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier hs-type">elemBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="#local-6989586621680827673"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827673"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827673"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-63"></span><span id="elemBag"><span class="annot"><span class="annottext">elemBag :: forall a. Eq a =&gt; a -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier hs-var hs-var">elemBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-64"></span><span class="annot"><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier hs-var">elemBag</span></a></span><span> </span><span id="local-6989586621680827283"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827283"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827282"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827282"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827283"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827282"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-65"></span><span class="annot"><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier hs-var">elemBag</span></a></span><span> </span><span id="local-6989586621680827281"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827281"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827280"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827280"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827279"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827279"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827281"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag a -&gt; Bool
forall a. Eq a =&gt; a -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#elemBag"><span class="hs-operator hs-var">`elemBag`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827280"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827281"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag a -&gt; Bool
forall a. Eq a =&gt; a -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#elemBag"><span class="hs-operator hs-var">`elemBag`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827279"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-66"></span><span class="annot"><a href="GHC.Data.Bag.html#elemBag"><span class="hs-identifier hs-var">elemBag</span></a></span><span> </span><span id="local-6989586621680827277"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827277"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827276"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827276"><span class="hs-identifier hs-var">ys</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827277"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; a -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827276"><span class="hs-identifier hs-var">ys</span></a></span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span id="local-6989586621680827668"><span class="annot"><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-type">unionManyBags</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827668"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827668"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-69"></span><span id="unionManyBags"><span class="annot"><span class="annottext">unionManyBags :: forall a. [Bag a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionManyBags"><span class="hs-identifier hs-var hs-var">unionManyBags</span></a></span></span><span> </span><span id="local-6989586621680827273"><span class="annot"><span class="annottext">[Bag a]
</span><a href="#local-6989586621680827273"><span class="hs-identifier hs-var">xs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bag a -&gt; Bag a -&gt; Bag a) -&gt; Bag a -&gt; [Bag a] -&gt; Bag a
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">[Bag a]
</span><a href="#local-6989586621680827273"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-70"></span><span>
</span><span id="line-71"></span><span class="hs-comment">-- This one is a bit stricter! The bag will get completely evaluated.</span><span>
</span><span id="line-72"></span><span>
</span><span id="line-73"></span><span id="local-6989586621680827664"><span class="annot"><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-type">unionBags</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827664"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827664"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827664"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-74"></span><span id="unionBags"><span class="annot"><span class="annottext">unionBags :: forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var hs-var">unionBags</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span id="local-6989586621680827271"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827271"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827271"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-75"></span><span class="annot"><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span id="local-6989586621680827270"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827270"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827270"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-76"></span><span class="annot"><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span id="local-6989586621680827269"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827269"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827268"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827268"><span class="hs-identifier hs-var">b2</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827269"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827268"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span id="local-6989586621680827662"><span class="annot"><a href="GHC.Data.Bag.html#consBag"><span class="hs-identifier hs-type">consBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680827662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827662"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827662"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-79"></span><span id="local-6989586621680827660"><span class="annot"><a href="GHC.Data.Bag.html#snocBag"><span class="hs-identifier hs-type">snocBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827660"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827660"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827660"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span id="consBag"><span class="annot"><span class="annottext">consBag :: forall a. a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#consBag"><span class="hs-identifier hs-var hs-var">consBag</span></a></span></span><span> </span><span id="local-6989586621680827267"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827267"><span class="hs-identifier hs-var">elt</span></a></span></span><span> </span><span id="local-6989586621680827266"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827266"><span class="hs-identifier hs-var">bag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Bag a
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827267"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827266"><span class="hs-identifier hs-var">bag</span></a></span><span>
</span><span id="line-82"></span><span id="snocBag"><span class="annot"><span class="annottext">snocBag :: forall a. Bag a -&gt; a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#snocBag"><span class="hs-identifier hs-var hs-var">snocBag</span></a></span></span><span> </span><span id="local-6989586621680827265"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827265"><span class="hs-identifier hs-var">bag</span></a></span></span><span> </span><span id="local-6989586621680827264"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827264"><span class="hs-identifier hs-var">elt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827265"><span class="hs-identifier hs-var">bag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Bag a
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827264"><span class="hs-identifier hs-var">elt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span id="local-6989586621680827658"><span class="annot"><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-type">isEmptyBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827658"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-85"></span><span id="isEmptyBag"><span class="annot"><span class="annottext">isEmptyBag :: forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var hs-var">isEmptyBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-86"></span><span class="annot"><a href="GHC.Data.Bag.html#isEmptyBag"><span class="hs-identifier hs-var">isEmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- NB invariants</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span id="local-6989586621680827263"><span class="annot"><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier hs-type">isSingletonBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827263"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-89"></span><span id="isSingletonBag"><span class="annot"><span class="annottext">isSingletonBag :: forall a. Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier hs-var hs-var">isSingletonBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-90"></span><span class="annot"><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier hs-var">isSingletonBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-91"></span><span class="annot"><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier hs-var">isSingletonBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>          </span><span class="hs-comment">-- Neither is empty</span><span>
</span><span id="line-92"></span><span class="annot"><a href="GHC.Data.Bag.html#isSingletonBag"><span class="hs-identifier hs-var">isSingletonBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827262"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827262"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#isSingleton"><span class="hs-identifier hs-var">isSingleton</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827262"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span id="local-6989586621680827654"><span class="annot"><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-type">filterBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827654"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827654"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827654"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-95"></span><span id="filterBag"><span class="annot"><span class="annottext">filterBag :: forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var hs-var">filterBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-96"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span id="local-6989586621680827260"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827260"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span id="local-6989586621680827259"><span class="annot"><span class="annottext">b :: Bag a
</span><a href="#local-6989586621680827259"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827258"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827258"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827260"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827258"><span class="hs-identifier hs-var">val</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827259"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-97"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span id="local-6989586621680827257"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827257"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827256"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827256"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827255"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827255"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827254"><span class="hs-identifier hs-var">sat1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827253"><span class="hs-identifier hs-var">sat2</span></a></span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680827254"><span class="annot"><span class="annottext">sat1 :: Bag a
</span><a href="#local-6989586621680827254"><span class="hs-identifier hs-var hs-var">sat1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bag a
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827257"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827256"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-99"></span><span>          </span><span id="local-6989586621680827253"><span class="annot"><span class="annottext">sat2 :: Bag a
</span><a href="#local-6989586621680827253"><span class="hs-identifier hs-var hs-var">sat2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bag a
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827257"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827255"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-100"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBag"><span class="hs-identifier hs-var">filterBag</span></a></span><span> </span><span id="local-6989586621680827252"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827252"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827251"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827251"><span class="hs-identifier hs-var">vs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; [a]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827252"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827251"><span class="hs-identifier hs-var">vs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span id="local-6989586621680827649"><span id="local-6989586621680827650"><span class="annot"><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-type">filterBagM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827650"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827649"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827650"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827649"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827650"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827649"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-103"></span><span id="filterBagM"><span class="annot"><span class="annottext">filterBagM :: forall (m :: * -&gt; *) a.
Monad m =&gt;
(a -&gt; m Bool) -&gt; Bag a -&gt; m (Bag a)
</span><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var hs-var">filterBagM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-104"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var">filterBagM</span></a></span><span> </span><span id="local-6989586621680827235"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827235"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span id="local-6989586621680827234"><span class="annot"><span class="annottext">b :: Bag a
</span><a href="#local-6989586621680827234"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827233"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827233"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-105"></span><span>  </span><span id="local-6989586621680827232"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680827232"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827235"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827233"><span class="hs-identifier hs-var">val</span></a></span><span>
</span><span id="line-106"></span><span>  </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680827232"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827234"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-107"></span><span>          </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-108"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var">filterBagM</span></a></span><span> </span><span id="local-6989586621680827231"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827231"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827230"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827230"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827229"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827229"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-109"></span><span>  </span><span id="local-6989586621680827228"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827228"><span class="hs-identifier hs-var">sat1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a.
Monad m =&gt;
(a -&gt; m Bool) -&gt; Bag a -&gt; m (Bag a)
</span><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var">filterBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827231"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827230"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-110"></span><span>  </span><span id="local-6989586621680827227"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827227"><span class="hs-identifier hs-var">sat2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a.
Monad m =&gt;
(a -&gt; m Bool) -&gt; Bag a -&gt; m (Bag a)
</span><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var">filterBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827231"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827229"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-111"></span><span>  </span><span class="annot"><span class="annottext">Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827228"><span class="hs-identifier hs-var">sat1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827227"><span class="hs-identifier hs-var">sat2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span class="annot"><a href="GHC.Data.Bag.html#filterBagM"><span class="hs-identifier hs-var">filterBagM</span></a></span><span> </span><span id="local-6989586621680827226"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827226"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827225"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827225"><span class="hs-identifier hs-var">vs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-113"></span><span>  </span><span id="local-6989586621680827224"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827224"><span class="hs-identifier hs-var">sat</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; [a] -&gt; m [a]
forall (m :: * -&gt; *) a.
Applicative m =&gt;
(a -&gt; m Bool) -&gt; [a] -&gt; m [a]
</span><a href="../../base/src/Control.Monad.html#filterM"><span class="hs-identifier hs-var">filterM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827226"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827225"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-114"></span><span>  </span><span class="annot"><span class="annottext">Bag a -&gt; m (Bag a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827224"><span class="hs-identifier hs-var">sat</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span id="local-6989586621680827642"><span class="annot"><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-type">allBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827642"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827642"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-117"></span><span id="allBag"><span class="annot"><span class="annottext">allBag :: forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var hs-var">allBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-118"></span><span class="annot"><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span id="local-6989586621680827221"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827221"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827220"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827220"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827221"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827220"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-119"></span><span class="annot"><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span id="local-6989586621680827219"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827219"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827218"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827218"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827217"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827217"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827219"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827218"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827219"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827217"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-120"></span><span class="annot"><a href="GHC.Data.Bag.html#allBag"><span class="hs-identifier hs-var">allBag</span></a></span><span> </span><span id="local-6989586621680827215"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827215"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827214"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827214"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827215"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827214"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-121"></span><span>
</span><span id="line-122"></span><span id="local-6989586621680827212"><span class="annot"><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-type">anyBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827212"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827212"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-123"></span><span id="anyBag"><span class="annot"><span class="annottext">anyBag :: forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var hs-var">anyBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-124"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span id="local-6989586621680827210"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827210"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827209"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827209"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827210"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827209"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-125"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span id="local-6989586621680827208"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827208"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827207"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827207"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827206"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827206"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827208"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827207"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; Bool
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; Bool
</span><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827208"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827206"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-126"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBag"><span class="hs-identifier hs-var">anyBag</span></a></span><span> </span><span id="local-6989586621680827205"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827205"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827204"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827204"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827205"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827204"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span id="local-6989586621680827638"><span id="local-6989586621680827639"><span class="annot"><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-type">anyBagM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827639"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827638"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827639"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827638"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827639"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-129"></span><span id="anyBagM"><span class="annot"><span class="annottext">anyBagM :: forall (m :: * -&gt; *) a. Monad m =&gt; (a -&gt; m Bool) -&gt; Bag a -&gt; m Bool
</span><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var hs-var">anyBagM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; m Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-130"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var">anyBagM</span></a></span><span> </span><span id="local-6989586621680827196"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827196"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827195"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827195"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827196"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827195"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-131"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var">anyBagM</span></a></span><span> </span><span id="local-6989586621680827194"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827194"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827193"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827193"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827192"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827192"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680827191"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680827191"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; Bag a -&gt; m Bool
forall (m :: * -&gt; *) a. Monad m =&gt; (a -&gt; m Bool) -&gt; Bag a -&gt; m Bool
</span><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var">anyBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827194"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827193"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-132"></span><span>                               </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680827191"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; m Bool
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-133"></span><span>                                       </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; Bag a -&gt; m Bool
forall (m :: * -&gt; *) a. Monad m =&gt; (a -&gt; m Bool) -&gt; Bag a -&gt; m Bool
</span><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var">anyBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827194"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827192"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-134"></span><span class="annot"><a href="GHC.Data.Bag.html#anyBagM"><span class="hs-identifier hs-var">anyBagM</span></a></span><span> </span><span id="local-6989586621680827190"><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827190"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827189"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827189"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m Bool) -&gt; [a] -&gt; m Bool
forall (m :: * -&gt; *) a. Monad m =&gt; (a -&gt; m Bool) -&gt; [a] -&gt; m Bool
</span><a href="GHC.Utils.Monad.html#anyM"><span class="hs-identifier hs-var">anyM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m Bool
</span><a href="#local-6989586621680827190"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827189"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span id="local-6989586621680827633"><span class="annot"><a href="GHC.Data.Bag.html#concatBag"><span class="hs-identifier hs-type">concatBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827633"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827633"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-137"></span><span id="concatBag"><span class="annot"><span class="annottext">concatBag :: forall a. Bag (Bag a) -&gt; Bag a
</span><a href="GHC.Data.Bag.html#concatBag"><span class="hs-identifier hs-var hs-var">concatBag</span></a></span></span><span> </span><span id="local-6989586621680827186"><span class="annot"><span class="annottext">Bag (Bag a)
</span><a href="#local-6989586621680827186"><span class="hs-identifier hs-var">bss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bag a -&gt; Bag a -&gt; Bag a) -&gt; Bag a -&gt; Bag (Bag a) -&gt; Bag a
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="#local-6989586621680827185"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag (Bag a)
</span><a href="#local-6989586621680827186"><span class="hs-identifier hs-var">bss</span></a></span><span>
</span><span id="line-138"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-139"></span><span>    </span><span id="local-6989586621680827185"><span class="annot"><span class="annottext">add :: Bag a -&gt; Bag a -&gt; Bag a
</span><a href="#local-6989586621680827185"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621680827184"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827184"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621680827183"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827183"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827184"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827183"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span id="local-6989586621680827630"><span class="annot"><a href="GHC.Data.Bag.html#catBagMaybes"><span class="hs-identifier hs-type">catBagMaybes</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827630"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827630"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-142"></span><span id="catBagMaybes"><span class="annot"><span class="annottext">catBagMaybes :: forall a. Bag (Maybe a) -&gt; Bag a
</span><a href="GHC.Data.Bag.html#catBagMaybes"><span class="hs-identifier hs-var hs-var">catBagMaybes</span></a></span></span><span> </span><span id="local-6989586621680827181"><span class="annot"><span class="annottext">Bag (Maybe a)
</span><a href="#local-6989586621680827181"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Maybe a -&gt; Bag a -&gt; Bag a) -&gt; Bag a -&gt; Bag (Maybe a) -&gt; Bag a
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; Bag a -&gt; Bag a
forall {a}. Maybe a -&gt; Bag a -&gt; Bag a
</span><a href="#local-6989586621680827180"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">Bag (Maybe a)
</span><a href="#local-6989586621680827181"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-144"></span><span>    </span><span id="local-6989586621680827180"><span class="annot"><span class="annottext">add :: Maybe a -&gt; Bag a -&gt; Bag a
</span><a href="#local-6989586621680827180"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span id="local-6989586621680827179"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827179"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827179"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-145"></span><span>    </span><span class="annot"><a href="#local-6989586621680827180"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680827178"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827178"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680827177"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827177"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827178"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag a -&gt; Bag a
forall a. a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#consBag"><span class="hs-operator hs-var">`consBag`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827177"><span class="hs-identifier hs-var">rs</span></a></span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span id="local-6989586621680827627"><span class="annot"><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-type">partitionBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827627"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827627"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827627"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-comment">{- Satisfy predictate -}</span><span class="hs-special">,</span><span>
</span><span id="line-148"></span><span>                                         </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827627"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-comment">{- Don't -}</span><span class="hs-special">)</span></span><span>
</span><span id="line-149"></span><span id="partitionBag"><span class="annot"><span class="annottext">partitionBag :: forall a. (a -&gt; Bool) -&gt; Bag a -&gt; (Bag a, Bag a)
</span><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var hs-var">partitionBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var">partitionBag</span></a></span><span> </span><span id="local-6989586621680827176"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827176"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span id="local-6989586621680827175"><span class="annot"><span class="annottext">b :: Bag a
</span><a href="#local-6989586621680827175"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827174"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827174"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827176"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827174"><span class="hs-identifier hs-var">val</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827175"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827175"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-152"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var">partitionBag</span></a></span><span> </span><span id="local-6989586621680827173"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827173"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827172"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827172"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827171"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827171"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827170"><span class="hs-identifier hs-var">sat1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827169"><span class="hs-identifier hs-var">sat2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827168"><span class="hs-identifier hs-var">fail1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; Bag a -&gt; Bag a
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827167"><span class="hs-identifier hs-var">fail2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827170"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827170"><span class="hs-identifier hs-var">sat1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827168"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827168"><span class="hs-identifier hs-var">fail1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; (Bag a, Bag a)
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; (Bag a, Bag a)
</span><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var">partitionBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827173"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827172"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-155"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680827169"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827169"><span class="hs-identifier hs-var">sat2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827167"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827167"><span class="hs-identifier hs-var">fail2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; Bag a -&gt; (Bag a, Bag a)
forall a. (a -&gt; Bool) -&gt; Bag a -&gt; (Bag a, Bag a)
</span><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var">partitionBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827173"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827171"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-156"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBag"><span class="hs-identifier hs-var">partitionBag</span></a></span><span> </span><span id="local-6989586621680827166"><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827166"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827165"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827165"><span class="hs-identifier hs-var">vs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827164"><span class="hs-identifier hs-var">sats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827163"><span class="hs-identifier hs-var">fails</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827164"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827164"><span class="hs-identifier hs-var">sats</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827163"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827163"><span class="hs-identifier hs-var">fails</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bool
</span><a href="#local-6989586621680827166"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827165"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-158"></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span id="local-6989586621680827622"><span id="local-6989586621680827623"><span id="local-6989586621680827624"><span class="annot"><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-type">partitionBagWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827624"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827623"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827622"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827624"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-161"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827623"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-comment">{- Left  -}</span><span class="hs-special">,</span><span>
</span><span id="line-162"></span><span>                        </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827622"><span class="hs-identifier hs-type">c</span></a></span><span> </span><span class="hs-comment">{- Right -}</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-163"></span><span id="partitionBagWith"><span class="annot"><span class="annottext">partitionBagWith :: forall a b c. (a -&gt; Either b c) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var hs-var">partitionBagWith</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><span class="hs-identifier">_</span></span><span>    </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var">partitionBagWith</span></a></span><span> </span><span id="local-6989586621680827162"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827162"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827161"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827161"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-165"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827162"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827161"><span class="hs-identifier hs-var">val</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-166"></span><span>         </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680827160"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827160"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Bag b
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827160"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-167"></span><span>         </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680827159"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680827159"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c -&gt; Bag c
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680827159"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var">partitionBagWith</span></a></span><span> </span><span id="local-6989586621680827158"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827158"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827157"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827157"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827156"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827156"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827155"><span class="hs-identifier hs-var">sat1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827154"><span class="hs-identifier hs-var">sat2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827153"><span class="hs-identifier hs-var">fail1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827152"><span class="hs-identifier hs-var">fail2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827155"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827155"><span class="hs-identifier hs-var">sat1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827153"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827153"><span class="hs-identifier hs-var">fail1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Either b c) -&gt; Bag a -&gt; (Bag b, Bag c)
forall a b c. (a -&gt; Either b c) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var">partitionBagWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827158"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827157"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-171"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680827154"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827154"><span class="hs-identifier hs-var">sat2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827152"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827152"><span class="hs-identifier hs-var">fail2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Either b c) -&gt; Bag a -&gt; (Bag b, Bag c)
forall a b c. (a -&gt; Either b c) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var">partitionBagWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827158"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827156"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-172"></span><span class="annot"><a href="GHC.Data.Bag.html#partitionBagWith"><span class="hs-identifier hs-var">partitionBagWith</span></a></span><span> </span><span id="local-6989586621680827151"><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827151"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827150"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827150"><span class="hs-identifier hs-var">vs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; Bag b
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680827149"><span class="hs-identifier hs-var">sats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[c] -&gt; Bag c
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680827148"><span class="hs-identifier hs-var">fails</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-173"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827149"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680827149"><span class="hs-identifier hs-var">sats</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827148"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680827148"><span class="hs-identifier hs-var">fails</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Either b c
</span><a href="#local-6989586621680827151"><span class="hs-identifier hs-var">pred</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827150"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span id="local-6989586621680827614"><span id="local-6989586621680827615"><span class="annot"><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-type">foldBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Replace TwoBags with this; should be associative</span><span>
</span><span id="line-176"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827614"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span>      </span><span class="hs-comment">-- Replace UnitBag with this</span><span>
</span><span id="line-177"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span><span>             </span><span class="hs-comment">-- Replace EmptyBag with this</span><span>
</span><span id="line-178"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827614"><span class="hs-identifier hs-type">a</span></a></span><span>
</span><span id="line-179"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827615"><span class="hs-identifier hs-type">r</span></a></span></span></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-comment">{- Standard definition
foldBag t u e EmptyBag        = e
foldBag t u e (UnitBag x)     = u x
foldBag t u e (TwoBags b1 b2) = (foldBag t u e b1) `t` (foldBag t u e b2)
foldBag t u e (ListBag xs)    = foldr (t.u) e xs
-}</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span class="hs-comment">-- More tail-recursive definition, exploiting associativity of &quot;t&quot;</span><span>
</span><span id="line-189"></span><span id="foldBag"><span class="annot"><span class="annottext">foldBag :: forall r a. (r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; r -&gt; Bag a -&gt; r
</span><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var hs-var">foldBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">a -&gt; r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680827145"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827145"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827145"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-190"></span><span class="annot"><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var">foldBag</span></a></span><span> </span><span id="local-6989586621680827144"><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827144"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680827143"><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827143"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680827142"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827142"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827141"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827141"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827143"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827141"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827144"><span class="hs-operator hs-var">`t`</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827142"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var">foldBag</span></a></span><span> </span><span id="local-6989586621680827140"><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827140"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680827139"><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827139"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680827138"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827138"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827137"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827137"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827136"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827136"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; r -&gt; Bag a -&gt; r
forall r a. (r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; r -&gt; Bag a -&gt; r
</span><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var">foldBag</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827140"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827139"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; r -&gt; Bag a -&gt; r
forall r a. (r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; r -&gt; Bag a -&gt; r
</span><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var">foldBag</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827140"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827139"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827138"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827136"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827137"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-192"></span><span class="annot"><a href="GHC.Data.Bag.html#foldBag"><span class="hs-identifier hs-var">foldBag</span></a></span><span> </span><span id="local-6989586621680827135"><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827135"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680827134"><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827134"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span id="local-6989586621680827133"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827133"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827132"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827132"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; r -&gt; r) -&gt; r -&gt; [a] -&gt; r
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">r -&gt; r -&gt; r
</span><a href="#local-6989586621680827135"><span class="hs-identifier hs-var">t</span></a></span><span class="annot"><span class="annottext">(r -&gt; r -&gt; r) -&gt; (a -&gt; r) -&gt; a -&gt; r -&gt; r
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span class="annot"><span class="annottext">a -&gt; r
</span><a href="#local-6989586621680827134"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621680827133"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827132"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-193"></span><span>
</span><span id="line-194"></span><span id="local-6989586621680827129"><span id="local-6989586621680827130"><span class="annot"><a href="GHC.Data.Bag.html#mapBag"><span class="hs-identifier hs-type">mapBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827129"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827130"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827129"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-195"></span><span id="mapBag"><span class="annot"><span class="annottext">mapBag :: forall a b. (a -&gt; b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapBag"><span class="hs-identifier hs-var hs-var">mapBag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b) -&gt; Bag a -&gt; Bag b
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span id="local-6989586621680827605"><span id="local-6989586621680827606"><span class="annot"><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-type">concatMapBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827606"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827605"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827606"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827605"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-198"></span><span id="concatMapBag"><span class="annot"><span class="annottext">concatMapBag :: forall a b. (a -&gt; Bag b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var hs-var">concatMapBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-199"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var">concatMapBag</span></a></span><span> </span><span id="local-6989586621680827126"><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827126"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827125"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827125"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827126"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827125"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-200"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var">concatMapBag</span></a></span><span> </span><span id="local-6989586621680827124"><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827124"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827123"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827123"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827122"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827122"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bag b) -&gt; Bag a -&gt; Bag b
forall a b. (a -&gt; Bag b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var">concatMapBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827124"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827123"><span class="hs-identifier hs-var">b1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Bag b) -&gt; Bag a -&gt; Bag b
forall a b. (a -&gt; Bag b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var">concatMapBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827124"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827122"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBag"><span class="hs-identifier hs-var">concatMapBag</span></a></span><span> </span><span id="local-6989586621680827121"><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827121"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827120"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827120"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bag b -&gt; Bag b) -&gt; Bag b -&gt; [a] -&gt; Bag b
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">(Bag b -&gt; Bag b -&gt; Bag b) -&gt; (a -&gt; Bag b) -&gt; a -&gt; Bag b -&gt; Bag b
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b
</span><a href="#local-6989586621680827121"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827120"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span id="local-6989586621680827600"><span id="local-6989586621680827601"><span id="local-6989586621680827602"><span class="annot"><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-type">concatMapBagPair</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827602"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827601"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827600"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827602"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827601"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827600"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-204"></span><span id="concatMapBagPair"><span class="annot"><span class="annottext">concatMapBagPair :: forall a b c. (a -&gt; (Bag b, Bag c)) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var hs-var">concatMapBagPair</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-205"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var">concatMapBagPair</span></a></span><span> </span><span id="local-6989586621680827118"><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827118"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827117"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827117"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827118"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827117"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-206"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var">concatMapBagPair</span></a></span><span> </span><span id="local-6989586621680827116"><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827116"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827115"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827115"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827114"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827114"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827113"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827112"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827111"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827110"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680827113"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827113"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827111"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827111"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (Bag b, Bag c)) -&gt; Bag a -&gt; (Bag b, Bag c)
forall a b c. (a -&gt; (Bag b, Bag c)) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var">concatMapBagPair</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827116"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827115"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680827112"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827112"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827110"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827110"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (Bag b, Bag c)) -&gt; Bag a -&gt; (Bag b, Bag c)
forall a b c. (a -&gt; (Bag b, Bag c)) -&gt; Bag a -&gt; (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var">concatMapBagPair</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827116"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827114"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.Data.Bag.html#concatMapBagPair"><span class="hs-identifier hs-var">concatMapBagPair</span></a></span><span> </span><span id="local-6989586621680827109"><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827109"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827108"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827108"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (Bag b, Bag c) -&gt; (Bag b, Bag c))
-&gt; (Bag b, Bag c) -&gt; [a] -&gt; (Bag b, Bag c)
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c) -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827107"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827108"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-212"></span><span>    </span><span id="local-6989586621680827107"><span class="annot"><span class="annottext">go :: a -&gt; (Bag b, Bag c) -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827107"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680827106"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827106"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827105"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827105"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827104"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827104"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827103"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827105"><span class="hs-identifier hs-var">s1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827102"><span class="hs-identifier hs-var">r2</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827104"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-213"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-214"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680827103"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827103"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680827102"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827102"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c)
</span><a href="#local-6989586621680827109"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827106"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span id="local-6989586621680827595"><span id="local-6989586621680827596"><span class="annot"><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-type">mapMaybeBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827596"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827595"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827596"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827595"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-217"></span><span id="mapMaybeBag"><span class="annot"><span class="annottext">mapMaybeBag :: forall a b. (a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var hs-var">mapMaybeBag</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-218"></span><span class="annot"><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span id="local-6989586621680827101"><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827101"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827100"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827100"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827101"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827100"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-219"></span><span>                                  </span><span class="annot"><span class="annottext">Maybe b
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-220"></span><span>                                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680827099"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827099"><span class="hs-identifier hs-var">y</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bag b
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827099"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-221"></span><span class="annot"><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span id="local-6989586621680827098"><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827098"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827097"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827097"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827096"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827096"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
forall a b. (a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827098"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827097"><span class="hs-identifier hs-var">b1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
forall a b. (a -&gt; Maybe b) -&gt; Bag a -&gt; Bag b
</span><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827098"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827096"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-222"></span><span class="annot"><a href="GHC.Data.Bag.html#mapMaybeBag"><span class="hs-identifier hs-var">mapMaybeBag</span></a></span><span> </span><span id="local-6989586621680827095"><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827095"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680827094"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827094"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[b] -&gt; Bag b
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; Maybe b) -&gt; [a] -&gt; [b]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Maybe b
</span><a href="#local-6989586621680827095"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827094"><span class="hs-identifier hs-var">xs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span id="local-6989586621680827588"><span id="local-6989586621680827589"><span id="local-6989586621680827590"><span class="annot"><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-type">mapBagM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827590"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827589"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827590"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827588"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827589"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827590"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827588"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-225"></span><span id="mapBagM"><span class="annot"><span class="annottext">mapBagM :: forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m b) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var hs-var">mapBagM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-226"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var">mapBagM</span></a></span><span> </span><span id="local-6989586621680827079"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827079"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827078"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827078"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680827077"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827077"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827079"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827078"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-227"></span><span>                               </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Bag b
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680827077"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var">mapBagM</span></a></span><span> </span><span id="local-6989586621680827076"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827076"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827075"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827075"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827074"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827074"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680827073"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827073"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; Bag a -&gt; m (Bag b)
forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m b) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var">mapBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827076"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827075"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-229"></span><span>                               </span><span id="local-6989586621680827072"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827072"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; Bag a -&gt; m (Bag b)
forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m b) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var">mapBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827076"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827074"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-230"></span><span>                               </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827073"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827072"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-231"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM"><span class="hs-identifier hs-var">mapBagM</span></a></span><span> </span><span id="local-6989586621680827071"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827071"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span>    </span><span id="local-6989586621680827070"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827070"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680827069"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680827069"><span class="hs-identifier hs-var">rs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; [a] -&gt; m [b]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827071"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827070"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-232"></span><span>                               </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; Bag b
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680827069"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span id="local-6989586621680827578"><span id="local-6989586621680827579"><span id="local-6989586621680827580"><span class="annot"><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-type">mapBagM_</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827580"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827579"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827580"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827578"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827579"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827580"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-235"></span><span id="mapBagM_"><span class="annot"><span class="annottext">mapBagM_ :: forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; Bag a -&gt; m ()
</span><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var hs-var">mapBagM_</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; m ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-236"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var">mapBagM_</span></a></span><span> </span><span id="local-6989586621680827058"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827058"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827057"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827057"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827058"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827057"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">m b -&gt; m () -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; m ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var">mapBagM_</span></a></span><span> </span><span id="local-6989586621680827056"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827056"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827055"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827055"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827054"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827054"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; Bag a -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; Bag a -&gt; m ()
</span><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var">mapBagM_</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827056"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827055"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">m () -&gt; m () -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; Bag a -&gt; m ()
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m b) -&gt; Bag a -&gt; m ()
</span><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var">mapBagM_</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827056"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827054"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-238"></span><span class="annot"><a href="GHC.Data.Bag.html#mapBagM_"><span class="hs-identifier hs-var">mapBagM_</span></a></span><span> </span><span id="local-6989586621680827053"><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827053"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span>    </span><span id="local-6989586621680827052"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827052"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m b) -&gt; [a] -&gt; m ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m b
</span><a href="#local-6989586621680827053"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827052"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-239"></span><span>
</span><span id="line-240"></span><span id="local-6989586621680827566"><span id="local-6989586621680827567"><span id="local-6989586621680827568"><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-type">flatMapBagM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827568"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827567"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827568"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827567"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827568"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827566"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-241"></span><span id="flatMapBagM"><span class="annot"><span class="annottext">flatMapBagM :: forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m (Bag b)) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var hs-var">flatMapBagM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-242"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var">flatMapBagM</span></a></span><span> </span><span id="local-6989586621680827041"><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827041"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827040"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827040"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827041"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827040"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-243"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var">flatMapBagM</span></a></span><span> </span><span id="local-6989586621680827039"><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827039"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827038"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827038"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827037"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827037"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680827036"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827036"><span class="hs-identifier hs-var">r1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (Bag b)) -&gt; Bag a -&gt; m (Bag b)
forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m (Bag b)) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var">flatMapBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827039"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827038"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-244"></span><span>                                   </span><span id="local-6989586621680827035"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827035"><span class="hs-identifier hs-var">r2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (Bag b)) -&gt; Bag a -&gt; m (Bag b)
forall (m :: * -&gt; *) a b.
Monad m =&gt;
(a -&gt; m (Bag b)) -&gt; Bag a -&gt; m (Bag b)
</span><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var">flatMapBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827039"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827037"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-245"></span><span>                                   </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827036"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827035"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagM"><span class="hs-identifier hs-var">flatMapBagM</span></a></span><span> </span><span id="local-6989586621680827034"><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827034"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span>    </span><span id="local-6989586621680827033"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827033"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; Bag b -&gt; m (Bag b)) -&gt; Bag b -&gt; [a] -&gt; m (Bag b)
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; b -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Data.Foldable.html#foldrM"><span class="hs-identifier hs-var">foldrM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag b -&gt; m (Bag b)
</span><a href="#local-6989586621680827031"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827033"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-247"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-248"></span><span>    </span><span id="local-6989586621680827031"><span class="annot"><span class="annottext">k :: a -&gt; Bag b -&gt; m (Bag b)
</span><a href="#local-6989586621680827031"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680827028"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827028"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680827027"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827027"><span class="hs-identifier hs-var">b2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680827026"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827026"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b)
</span><a href="#local-6989586621680827034"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827028"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; m (Bag b)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827026"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827027"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-249"></span><span>
</span><span id="line-250"></span><span id="local-6989586621680827555"><span id="local-6989586621680827556"><span id="local-6989586621680827557"><span id="local-6989586621680827558"><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-type">flatMapBagPairM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827558"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827557"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827558"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827556"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827555"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827557"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827558"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827556"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827555"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-251"></span><span id="flatMapBagPairM"><span class="annot"><span class="annottext">flatMapBagPairM :: forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (Bag b, Bag c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var hs-var">flatMapBagPairM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var">flatMapBagPairM</span></a></span><span> </span><span id="local-6989586621680827016"><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827016"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680827015"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827015"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827016"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827015"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-253"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var">flatMapBagPairM</span></a></span><span> </span><span id="local-6989586621680827014"><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827014"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680827013"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827013"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680827012"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827012"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827011"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827011"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680827010"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827010"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (Bag b, Bag c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (Bag b, Bag c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var">flatMapBagPairM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827014"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827013"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-254"></span><span>                                       </span><span class="hs-special">(</span><span id="local-6989586621680827009"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827009"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680827008"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827008"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (Bag b, Bag c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (Bag b, Bag c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var">flatMapBagPairM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827014"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680827012"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-255"></span><span>                                       </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827011"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827009"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827010"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827008"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-256"></span><span class="annot"><a href="GHC.Data.Bag.html#flatMapBagPairM"><span class="hs-identifier hs-var">flatMapBagPairM</span></a></span><span> </span><span id="local-6989586621680827007"><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827007"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span>    </span><span id="local-6989586621680827006"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827006"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (Bag b, Bag c) -&gt; m (Bag b, Bag c))
-&gt; (Bag b, Bag c) -&gt; [a] -&gt; m (Bag b, Bag c)
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; b -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Data.Foldable.html#foldrM"><span class="hs-identifier hs-var">foldrM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; (Bag b, Bag c) -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827005"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680827006"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-257"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-258"></span><span>    </span><span id="local-6989586621680827005"><span class="annot"><span class="annottext">k :: a -&gt; (Bag b, Bag c) -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827005"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680827002"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827002"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680827001"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827001"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680827000"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827000"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826999"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826999"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680826998"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826998"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; m (Bag b, Bag c)
</span><a href="#local-6989586621680827007"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680827002"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-259"></span><span>                     </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826999"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680827001"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826998"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680827000"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-260"></span><span>
</span><span id="line-261"></span><span id="local-6989586621680827547"><span id="local-6989586621680827548"><span id="local-6989586621680827549"><span id="local-6989586621680827550"><span class="annot"><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-type">mapAndUnzipBagM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827550"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827550"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827548"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621680827547"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827549"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827550"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827548"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827547"><span class="hs-identifier hs-type">c</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-262"></span><span id="mapAndUnzipBagM"><span class="annot"><span class="annottext">mapAndUnzipBagM :: forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (b, c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var hs-var">mapAndUnzipBagM</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var">mapAndUnzipBagM</span></a></span><span> </span><span id="local-6989586621680826984"><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826984"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826983"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826983"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826982"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826982"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680826981"><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680826981"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826984"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826983"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-264"></span><span>                                       </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b -&gt; Bag b
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826982"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">c -&gt; Bag c
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">c
</span><a href="#local-6989586621680826981"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var">mapAndUnzipBagM</span></a></span><span> </span><span id="local-6989586621680826980"><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826980"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826979"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826979"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826978"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826978"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826977"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826977"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680826976"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826976"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (b, c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (b, c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var">mapAndUnzipBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826980"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826979"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-266"></span><span>                                       </span><span class="hs-special">(</span><span id="local-6989586621680826975"><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826975"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680826974"><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826974"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (b, c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a b c.
Monad m =&gt;
(a -&gt; m (b, c)) -&gt; Bag a -&gt; m (Bag b, Bag c)
</span><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var">mapAndUnzipBagM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826980"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826978"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-267"></span><span>                                       </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826977"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
</span><a href="#local-6989586621680826975"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag c -&gt; Bag c -&gt; Bag c
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826976"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag c
</span><a href="#local-6989586621680826974"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAndUnzipBagM"><span class="hs-identifier hs-var">mapAndUnzipBagM</span></a></span><span> </span><span id="local-6989586621680826973"><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826973"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826972"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826972"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680826971"><span class="annot"><span class="annottext">[(b, c)]
</span><a href="#local-6989586621680826971"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(a -&gt; m (b, c)) -&gt; [a] -&gt; m [(b, c)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; m (b, c)
</span><a href="#local-6989586621680826973"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826972"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-269"></span><span>                                       </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826970"><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680826970"><span class="hs-identifier hs-var">rs</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680826969"><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680826969"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(b, c)] -&gt; ([b], [c])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(b, c)]
</span><a href="#local-6989586621680826971"><span class="hs-identifier hs-var">ts</span></a></span><span>
</span><span id="line-270"></span><span>                                       </span><span class="annot"><span class="annottext">(Bag b, Bag c) -&gt; m (Bag b, Bag c)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[b] -&gt; Bag b
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[b]
</span><a href="#local-6989586621680826970"><span class="hs-identifier hs-var">rs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[c] -&gt; Bag c
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[c]
</span><a href="#local-6989586621680826969"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span id="local-6989586621680827538"><span id="local-6989586621680827539"><span id="local-6989586621680827540"><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-type">mapAccumBagL</span></a></span><span> </span><span class="hs-glyph">::</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827540"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827539"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827540"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680827538"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ combining function</span><span>
</span><span id="line-273"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827540"><span class="hs-identifier hs-type">acc</span></a></span><span>                    </span><span class="hs-comment">-- ^ initial state</span><span>
</span><span id="line-274"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827539"><span class="hs-identifier hs-type">x</span></a></span><span>                  </span><span class="hs-comment">-- ^ inputs</span><span>
</span><span id="line-275"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827540"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827538"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span></span></span></span><span>           </span><span class="hs-comment">-- ^ final state, outputs</span><span>
</span><span id="line-276"></span><span id="mapAccumBagL"><span class="annot"><span class="annottext">mapAccumBagL :: forall acc x y.
(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var hs-var">mapAccumBagL</span></a></span></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680826967"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826967"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag x
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826967"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag y
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span id="local-6989586621680826966"><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826966"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826965"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826965"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826964"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621680826964"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826963"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826963"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826962"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621680826962"><span class="hs-identifier hs-var">x1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826966"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826965"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621680826964"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826963"><span class="hs-identifier hs-var">s1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">y -&gt; Bag y
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621680826962"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-278"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span id="local-6989586621680826961"><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826961"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826960"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826960"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826959"><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826959"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826958"><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826958"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826957"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826957"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826956"><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826956"><span class="hs-identifier hs-var">b1'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
forall acc x y.
(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826961"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826960"><span class="hs-identifier hs-var">s</span></a></span><span>  </span><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826959"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-279"></span><span>                                       </span><span class="hs-special">(</span><span id="local-6989586621680826955"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826955"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826954"><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826954"><span class="hs-identifier hs-var">b2'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
forall acc x y.
(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; Bag x -&gt; (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826961"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826957"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826958"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-280"></span><span>                                   </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826955"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag y -&gt; Bag y -&gt; Bag y
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826956"><span class="hs-identifier hs-var">b1'</span></a></span><span> </span><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826954"><span class="hs-identifier hs-var">b2'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagL"><span class="hs-identifier hs-var">mapAccumBagL</span></a></span><span> </span><span id="local-6989586621680826953"><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826953"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826952"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826952"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826951"><span class="annot"><span class="annottext">[x]
</span><a href="#local-6989586621680826951"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826949"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826949"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826948"><span class="annot"><span class="annottext">[y]
</span><a href="#local-6989586621680826948"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; [x] -&gt; (acc, [y])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; (acc, y)
</span><a href="#local-6989586621680826953"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826952"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[x]
</span><a href="#local-6989586621680826951"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-282"></span><span>                                   </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826949"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[y] -&gt; Bag y
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[y]
</span><a href="#local-6989586621680826948"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span id="local-6989586621680827527"><span id="local-6989586621680827528"><span id="local-6989586621680827529"><span id="local-6989586621680827530"><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-type">mapAccumBagLM</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827530"><span class="hs-identifier hs-type">m</span></a></span><span>
</span><span id="line-285"></span><span>            </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827529"><span class="hs-identifier hs-type">acc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827528"><span class="hs-identifier hs-type">x</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827530"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827529"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680827527"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- ^ combining function</span><span>
</span><span id="line-286"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827529"><span class="hs-identifier hs-type">acc</span></a></span><span>                      </span><span class="hs-comment">-- ^ initial state</span><span>
</span><span id="line-287"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827528"><span class="hs-identifier hs-type">x</span></a></span><span>                    </span><span class="hs-comment">-- ^ inputs</span><span>
</span><span id="line-288"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680827530"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680827529"><span class="hs-identifier hs-type">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827527"><span class="hs-identifier hs-type">y</span></a></span><span class="hs-special">)</span></span></span></span></span><span>           </span><span class="hs-comment">-- ^ final state, outputs</span><span>
</span><span id="line-289"></span><span id="mapAccumBagLM"><span class="annot"><span class="annottext">mapAccumBagLM :: forall (m :: * -&gt; *) acc x y.
Monad m =&gt;
(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; Bag x -&gt; m (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var hs-var">mapAccumBagLM</span></a></span></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680826935"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826935"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag x
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(acc, Bag y) -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826935"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag y
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var">mapAccumBagLM</span></a></span><span> </span><span id="local-6989586621680826934"><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826934"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826933"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826933"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826932"><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621680826932"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826931"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826931"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826930"><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621680826930"><span class="hs-identifier hs-var">x1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826934"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826933"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">x
</span><a href="#local-6989586621680826932"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(acc, Bag y) -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826931"><span class="hs-identifier hs-var">s1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">y -&gt; Bag y
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">y
</span><a href="#local-6989586621680826930"><span class="hs-identifier hs-var">x1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-291"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var">mapAccumBagLM</span></a></span><span> </span><span id="local-6989586621680826929"><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826929"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826928"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826928"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826927"><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826927"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826926"><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826926"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826925"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826925"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826924"><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826924"><span class="hs-identifier hs-var">b1'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; Bag x -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) acc x y.
Monad m =&gt;
(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; Bag x -&gt; m (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var">mapAccumBagLM</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826929"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826928"><span class="hs-identifier hs-var">s</span></a></span><span>  </span><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826927"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-292"></span><span>                                       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826923"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826923"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826922"><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826922"><span class="hs-identifier hs-var">b2'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; Bag x -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) acc x y.
Monad m =&gt;
(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; Bag x -&gt; m (acc, Bag y)
</span><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var">mapAccumBagLM</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826929"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826925"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag x
</span><a href="#local-6989586621680826926"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-293"></span><span>                                       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(acc, Bag y) -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826923"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bag y -&gt; Bag y -&gt; Bag y
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826924"><span class="hs-identifier hs-var">b1'</span></a></span><span> </span><span class="annot"><span class="annottext">Bag y
</span><a href="#local-6989586621680826922"><span class="hs-identifier hs-var">b2'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-294"></span><span class="annot"><a href="GHC.Data.Bag.html#mapAccumBagLM"><span class="hs-identifier hs-var">mapAccumBagLM</span></a></span><span> </span><span id="local-6989586621680826921"><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826921"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621680826920"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826920"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826919"><span class="annot"><span class="annottext">[x]
</span><a href="#local-6989586621680826919"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680826918"><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826918"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680826917"><span class="annot"><span class="annottext">[y]
</span><a href="#local-6989586621680826917"><span class="hs-identifier hs-var">xs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; [x] -&gt; m (acc, [y])
forall (m :: * -&gt; *) acc x y.
Monad m =&gt;
(acc -&gt; x -&gt; m (acc, y)) -&gt; acc -&gt; [x] -&gt; m (acc, [y])
</span><a href="GHC.Utils.Monad.html#mapAccumLM"><span class="hs-identifier hs-var">mapAccumLM</span></a></span><span> </span><span class="annot"><span class="annottext">acc -&gt; x -&gt; m (acc, y)
</span><a href="#local-6989586621680826921"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826920"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">[x]
</span><a href="#local-6989586621680826919"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-295"></span><span>                                       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(acc, Bag y) -&gt; m (acc, Bag y)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">acc
</span><a href="#local-6989586621680826918"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[y] -&gt; Bag y
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[y]
</span><a href="#local-6989586621680826917"><span class="hs-identifier hs-var">xs'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span id="local-6989586621680827652"><span class="annot"><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-type">listToBag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680827652"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827652"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-298"></span><span id="listToBag"><span class="annot"><span class="annottext">listToBag :: forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var hs-var">listToBag</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag a
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-299"></span><span class="annot"><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680826915"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826915"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; Bag a
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826915"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-300"></span><span class="annot"><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span id="local-6989586621680826914"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826914"><span class="hs-identifier hs-var">vs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826914"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span id="local-6989586621680827517"><span class="annot"><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-type">bagToList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827517"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680827517"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span></span><span>
</span><span id="line-303"></span><span id="bagToList"><span class="annot"><span class="annottext">bagToList :: forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var hs-var">bagToList</span></a></span></span><span> </span><span id="local-6989586621680826912"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826912"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; [a] -&gt; [a]) -&gt; [a] -&gt; Bag a -&gt; [a]
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">:</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826912"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span id="local-6989586621680827512"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680826909"><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827512"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827512"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-306"></span><span>    </span><span id="local-6989586621680826906"><span class="annot"><span class="annottext">ppr :: Bag a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span id="local-6989586621680826904"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826904"><span class="hs-identifier hs-var">bag</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; SDoc) -&gt; [a] -&gt; SDoc
forall a. (a -&gt; SDoc) -&gt; [a] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprWithCommas"><span class="hs-identifier hs-var">pprWithCommas</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag a -&gt; [a]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826904"><span class="hs-identifier hs-var">bag</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span id="local-6989586621680827477"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680826876"><span id="local-6989586621680826878"><span id="local-6989586621680826880"><span id="local-6989586621680826882"><span id="local-6989586621680826884"><span id="local-6989586621680826886"><span id="local-6989586621680826888"><span id="local-6989586621680826890"><span id="local-6989586621680826892"><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827477"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Data.html#Data"><span class="hs-identifier hs-type">Data</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680827477"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-309"></span><span>  </span><span id="local-6989586621680826872"><span class="annot"><span class="annottext">gfoldl :: forall (c :: * -&gt; *).
(forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b)
-&gt; (forall g. g -&gt; c g) -&gt; Bag a -&gt; c (Bag a)
</span><a href="../../base/src/Data.Data.html#gfoldl"><span class="hs-identifier hs-var hs-var hs-var hs-var">gfoldl</span></a></span></span><span> </span><span id="local-6989586621680826870"><span class="annot"><span class="annottext">forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621680826870"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826869"><span class="annot"><span class="annottext">forall g. g -&gt; c g
</span><a href="#local-6989586621680826869"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span id="local-6989586621680826868"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826868"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([a] -&gt; Bag a) -&gt; c ([a] -&gt; Bag a)
forall g. g -&gt; c g
</span><a href="#local-6989586621680826869"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Bag a
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">c ([a] -&gt; Bag a) -&gt; [a] -&gt; c (Bag a)
forall d b. Data d =&gt; c (d -&gt; b) -&gt; d -&gt; c b
</span><a href="#local-6989586621680826870"><span class="hs-operator hs-var">`k`</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a -&gt; [a]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826868"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-comment">-- traverse abstract type abstractly</span><span>
</span><span id="line-310"></span><span>  </span><span id="local-6989586621680826862"><span class="annot"><span class="annottext">toConstr :: Bag a -&gt; Constr
</span><a href="../../base/src/Data.Data.html#toConstr"><span class="hs-identifier hs-var hs-var hs-var hs-var">toConstr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><span class="hs-identifier">_</span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Constr
</span><a href="GHC.Utils.Misc.html#abstractConstr"><span class="hs-identifier hs-var">abstractConstr</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Constr) -&gt; String -&gt; Constr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Bag(&quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">TypeRep -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; TypeRep
forall a. Typeable a =&gt; a -&gt; TypeRep
</span><a href="../../base/src/Data.Typeable.html#typeOf"><span class="hs-identifier hs-var">typeOf</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
forall a. HasCallStack =&gt; a
</span><a href="../../base/src/GHC.Err.html#undefined"><span class="hs-identifier hs-var">undefined</span></a></span><span class="hs-glyph">::</span><span class="annot"><a href="#local-6989586621680827477"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-311"></span><span>  </span><span id="local-6989586621680826854"><span class="annot"><span class="annottext">gunfold :: forall (c :: * -&gt; *).
(forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r)
-&gt; (forall r. r -&gt; c r) -&gt; Constr -&gt; c (Bag a)
</span><a href="../../base/src/Data.Data.html#gunfold"><span class="hs-identifier hs-var hs-var hs-var hs-var">gunfold</span></a></span></span><span> </span><span class="annot"><span class="annottext">forall b r. Data b =&gt; c (b -&gt; r) -&gt; c r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">forall r. r -&gt; c r
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Constr -&gt; c (Bag a)
forall a. HasCallStack =&gt; String -&gt; a
</span><a href="../../base/src/GHC.Err.html#error"><span class="hs-identifier hs-var">error</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;gunfold&quot;</span></span><span>
</span><span id="line-312"></span><span>  </span><span id="local-6989586621680826851"><span class="annot"><span class="annottext">dataTypeOf :: Bag a -&gt; DataType
</span><a href="../../base/src/Data.Data.html#dataTypeOf"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataTypeOf</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; DataType
</span><a href="../../base/src/Data.Data.html#mkNoRepType"><span class="hs-identifier hs-var">mkNoRepType</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Bag&quot;</span></span><span>
</span><span id="line-313"></span><span>  </span><span id="local-6989586621680826844"><span class="annot"><span class="annottext">dataCast1 :: forall (t :: * -&gt; *) (c :: * -&gt; *).
Typeable t =&gt;
(forall d. Data d =&gt; c (t d)) -&gt; Maybe (c (Bag a))
</span><a href="../../base/src/Data.Data.html#dataCast1"><span class="hs-identifier hs-var hs-var hs-var hs-var">dataCast1</span></a></span></span><span> </span><span id="local-6989586621680826842"><span class="annot"><span class="annottext">forall d. Data d =&gt; c (t d)
</span><a href="#local-6989586621680826842"><span class="hs-identifier hs-var">x</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">c (t a) -&gt; Maybe (c (Bag a))
forall {k1} {k2} (c :: k1 -&gt; *) (t :: k2 -&gt; k1) (t' :: k2 -&gt; k1)
       (a :: k2).
(Typeable t, Typeable t') =&gt;
c (t a) -&gt; Maybe (c (t' a))
</span><a href="../../base/src/Data.Typeable.html#gcast1"><span class="hs-identifier hs-var">gcast1</span></a></span><span> </span><span class="annot"><span class="annottext">c (t a)
forall d. Data d =&gt; c (t d)
</span><a href="#local-6989586621680826842"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680826810"><span id="local-6989586621680826812"><span id="local-6989586621680826814"><span id="local-6989586621680826816"><span id="local-6989586621680826818"><span id="local-6989586621680826820"><span id="local-6989586621680826822"><span id="local-6989586621680826824"><span id="local-6989586621680826826"><span id="local-6989586621680826828"><span id="local-6989586621680826832"><span id="local-6989586621680826835"><span id="local-6989586621680826837"><span id="local-6989586621680826839"><span class="annot"><a href="../../base/src/Data.Foldable.html#Foldable"><span class="hs-identifier hs-type">Foldable.Foldable</span></a></span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-316"></span><span>  </span><span id="local-6989586621680826805"><span class="annot"><span class="annottext">foldr :: forall a b. (a -&gt; b -&gt; b) -&gt; b -&gt; Bag a -&gt; b
</span><a href="#local-6989586621680826805"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldr</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680826804"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826804"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826804"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-317"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span id="local-6989586621680826803"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826803"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826802"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826802"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826801"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826801"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826803"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826801"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826802"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-318"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span id="local-6989586621680826800"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826800"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826799"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826799"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826798"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826798"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826797"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826797"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826800"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826800"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826799"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826797"><span class="hs-identifier hs-var">b2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826798"><span class="hs-identifier hs-var">b1</span></a></span><span>
</span><span id="line-319"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span id="local-6989586621680826796"><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826796"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826795"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826795"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826794"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826794"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; b -&gt; b
</span><a href="#local-6989586621680826796"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826795"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826794"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span>  </span><span id="local-6989586621680826790"><span class="annot"><span class="annottext">foldl :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldl</span></a></span></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680826788"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826788"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826788"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-322"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span id="local-6989586621680826787"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826787"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826786"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826786"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826785"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826785"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826787"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826786"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826785"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span id="local-6989586621680826784"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826784"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826783"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826783"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826782"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826782"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826781"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826781"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826784"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826784"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826783"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826782"><span class="hs-identifier hs-var">b1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826781"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-324"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span id="local-6989586621680826780"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826780"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826779"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826779"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826778"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826778"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl"><span class="hs-identifier hs-var">foldl</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826780"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826779"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826778"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span>  </span><span id="local-6989586621680826775"><span class="annot"><span class="annottext">foldl' :: forall b a. (b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var hs-var hs-var hs-var">foldl'</span></a></span></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680826773"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826773"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826773"><span class="hs-identifier hs-var">z</span></a></span><span>
</span><span id="line-327"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span id="local-6989586621680826772"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826772"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826771"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826771"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826770"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826770"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826772"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826771"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826770"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-328"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span id="local-6989586621680826769"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826769"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826768"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826768"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826767"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826767"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826766"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826766"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680826764"><span class="annot"><span class="annottext">r1 :: b
</span><a href="#local-6989586621680826764"><span class="hs-identifier hs-var hs-var">r1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826769"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826768"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826767"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">b -&gt; b -&gt; b
</span><span class="hs-identifier hs-var">seq</span></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826764"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; b) -&gt; b -&gt; b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; Bag a -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826769"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826764"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826766"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-329"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span id="local-6989586621680826763"><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826763"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span id="local-6989586621680826762"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826762"><span class="hs-identifier hs-var">z</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826761"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826761"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">b -&gt; a -&gt; b
</span><a href="#local-6989586621680826763"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680826762"><span class="hs-identifier hs-var">z</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826761"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680826750"><span id="local-6989586621680826752"><span id="local-6989586621680826754"><span class="annot"><a href="../../base/src/Data.Traversable.html#Traversable"><span class="hs-identifier hs-type">Traversable</span></a></span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-332"></span><span>  </span><span id="local-6989586621680826734"><span class="annot"><span class="annottext">traverse :: forall (f :: * -&gt; *) a b.
Applicative f =&gt;
(a -&gt; f b) -&gt; Bag a -&gt; f (Bag b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var hs-var hs-var hs-var">traverse</span></a></span></span><span> </span><span class="annot"><span class="annottext">a -&gt; f b
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; f (Bag b)
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Bag b
forall a. Bag a
</span><a href="GHC.Data.Bag.html#EmptyBag"><span class="hs-identifier hs-var">EmptyBag</span></a></span><span>
</span><span id="line-333"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span id="local-6989586621680826732"><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826732"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-type">UnitBag</span></a></span><span> </span><span id="local-6989586621680826731"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826731"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">b -&gt; Bag b
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#UnitBag"><span class="hs-identifier hs-var">UnitBag</span></a></span><span> </span><span class="annot"><span class="annottext">(b -&gt; Bag b) -&gt; f b -&gt; f (Bag b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826732"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680826731"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-334"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span id="local-6989586621680826729"><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826729"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-type">TwoBags</span></a></span><span> </span><span id="local-6989586621680826728"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826728"><span class="hs-identifier hs-var">b1</span></a></span></span><span> </span><span id="local-6989586621680826727"><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826727"><span class="hs-identifier hs-var">b2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag b -&gt; Bag b -&gt; Bag b
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#TwoBags"><span class="hs-identifier hs-var">TwoBags</span></a></span><span> </span><span class="annot"><span class="annottext">(Bag b -&gt; Bag b -&gt; Bag b) -&gt; f (Bag b) -&gt; f (Bag b -&gt; Bag b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; f b) -&gt; Bag a -&gt; f (Bag b)
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826729"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826728"><span class="hs-identifier hs-var">b1</span></a></span><span> </span><span class="annot"><span class="annottext">f (Bag b -&gt; Bag b) -&gt; f (Bag b) -&gt; f (Bag b)
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var">&lt;*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; f b) -&gt; Bag a -&gt; f (Bag b)
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826729"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">Bag a
</span><a href="#local-6989586621680826727"><span class="hs-identifier hs-var">b2</span></a></span><span>
</span><span id="line-335"></span><span>  </span><span class="annot"><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span id="local-6989586621680826726"><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826726"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-type">ListBag</span></a></span><span> </span><span id="local-6989586621680826725"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826725"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[b] -&gt; Bag b
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#ListBag"><span class="hs-identifier hs-var">ListBag</span></a></span><span> </span><span class="annot"><span class="annottext">([b] -&gt; Bag b) -&gt; f [b] -&gt; f (Bag b)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(a -&gt; f b) -&gt; [a] -&gt; f [b]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; f b
</span><a href="#local-6989586621680826726"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680826725"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-336"></span></pre></body></html>